package ModelLayer;
import java.util.HashMap;

public class CustomerDiscount 
{
    private static CustomerDiscount instance = new CustomerDiscount();
    private static HashMap<String,Double> discounts = new HashMap<>();

    public CustomerDiscount() 
    {
        
    }
    
    public static CustomerDiscount getInstance()
    {
        if(instance==null) instance = new CustomerDiscount();
        return instance;
    }

    public static double getDiscount(String type)
    {
        return ( (discounts.containsKey(type)) ? discounts.get(type) : 0 );
    }

    public void addDiscount(String type, double customerDiscount) 
    {
        discounts.put(type, customerDiscount);
    }
    
    public boolean removeDiscount(String type)
    {
        return (discounts.remove(type)!=null);
    }
    
    public HashMap<String,Double> getDiscounts()
    {
    	return discounts;
    }

}
